<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input  type="text" id="txt" />
		<input type="button"  value="添加" id='addBtn'/>
		<input type="button"  value="删除" id='deleteBtn'/>
		
		<ul id="ul"></ul>
		<script type="text/javascript">
			var txt=document.getElementById('txt');
			var delBtn=document.getElementById('deleteBtn');
			var addBtn=document.getElementById('addBtn');
			var ul=document.getElementById('ul');
			addBtn.onclick=function(){
				var li=document.createElement('li');
				li.innerHTML=txt.value;
				ul.appendChild(li);
			}
			delBtn.onclick=function(){
				ul.lastElementChild.remove();
			}
		</script>
	</body>
</html>
